module backend_redirect (
  input        br_mispre_taken,
  input        br_mispre_is_br,
  input [31:0] br_mispre_pc,
  input [31:0] br_ds_pc   ,

  input        ex_redirect_taken,
  input [31:0] ex_redirect_pc,
  
  input [31:0] ex_pc      ,
  input        ex_taken   ,
  input [31:0] eret_pc    ,
  input        eret_taken ,
  input [31:0] tlb_pc     ,
  input        tlbp_taken ,
  input        tlbr_taken ,
  input        tlbwi_taken,
  input        tlbwr_taken,

  output        backend_redirect_taken,
  output        backend_redirect_is_br,
  output [31:0] backend_redirect_pc,
  output [31:0] backend_redirect_ds_pc
);

assign backend_redirect_taken = 
  // br_mispre_taken ||
  ex_redirect_taken ||
  ex_taken        ||
  eret_taken      ||
  tlbp_taken      ||
  tlbr_taken      ||
  tlbwi_taken     ||
  tlbwr_taken     ;

// assign backend_redirect_is_br = (br_mispre_taken && br_mispre_is_br && !eret_taken && !ex_taken) && !(tlbp_taken || tlbr_taken || tlbwi_taken);
assign backend_redirect_is_br = 1'b0;
assign backend_redirect_ds_pc = br_ds_pc;

assign backend_redirect_pc = 
  eret_taken ? eret_pc  :
  ex_taken   ? ex_pc    :
  (tlbp_taken || tlbr_taken || tlbwi_taken || tlbwr_taken) ? tlb_pc :
               ex_redirect_pc;
    
endmodule